package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.TraceTransport;
import com.ruoyi.system.api.domain.vo.CropsVo;
import com.ruoyi.system.api.factory.RemoteLogisticsFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 远程调用物流服务
 *
 * @author
 */
@FeignClient(contextId = "remoteLogisticsService", value = ServiceNameConstants.LOGISTICS_SERVER, fallbackFactory = RemoteLogisticsFallbackFactory.class)
public interface RemoteLogisticsService {

    /**
     * 根据部门id获取农作物列表
     *
     *
     * @param deptId
     * @return
     */
    @GetMapping("/logistics/listCrops/{deptId}")
    public R<List<TraceTransport>> listCrops(@PathVariable("deptId") String deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     *根据部门id获取农作物+物流列表
     * @param deptId
     * @param source
     * @return
     */
    @GetMapping("/logistics/queryCropsList/{deptId}")
    public R<List<CropsVo>> queryCropsList(@PathVariable("deptId") Integer deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 是否出库
     * @param cropsId
     * @return
     */
    @GetMapping("/logistics/changeInToOut/{cropsId}")
    public R<Integer> changeInToOut(@PathVariable("cropsId") String cropsId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);



    /**
     * 添加物流数据
     * @param traceTransport
     * @return
     */
    @PostMapping("/logistics/addTransport")
    public R<Integer> addTransport(@RequestBody TraceTransport traceTransport, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);



    /**
     * 修改零售签收状态
     * @param traceTransport
     * @return
     */
    @PostMapping("/logistics/updateReceiveStatus")
    public R<Integer> updateReceiveStatus(@RequestBody TraceTransport traceTransport, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


}
